package com.paper.tiger.easy.rpc.s.client.registy.common;

import com.paper.tiger.easy.rpc.core.ServerType;
import com.paper.tiger.easy.rpc.s.client.common.LetterType;
import com.paper.tiger.easy.rpc.s.client.execute.ResultFlyDove;
import com.paper.tiger.easy.rpc.s.client.registy.service.OffLineServiceImpl;
import com.paper.tiger.easy.rpc.s.client.registy.service.SelectRespServiceImpl;
import com.paper.tiger.easy.rpc.s.client.registy.service.SendAllRespServiceImpl;
import com.paper.tiger.easy.rpc.s.client.execute.ChanelFlyDove;
import com.paper.tiger.easy.rpc.s.client.execute.ExecuteFlyDove;

import java.util.HashMap;
import java.util.Map;

/**
 * [简要描述]:
 * [详细描述]:
 *
 * @author ZouHaiBo
 * @version 1.0, 2021/6/16 15:54
 * @since JDK 1.8
 */
public class RegisterConfig
{

    private static Map<String, Object> registerMap = new HashMap<>();

    public void register() {

        registerMap.put(ServerType.NEW_JOIN_SERVICE.getRegisterName(),new SendAllRespServiceImpl());
        registerMap.put(ServerType.SELECT_RESPONSE.getRegisterName(),new SelectRespServiceImpl());
        registerMap.put(ServerType.SERVER_OFF_LINE.getRegisterName(),new OffLineServiceImpl());

        registerMap.put(LetterType.CHANNEL.getRegisterName(),new ChanelFlyDove());
        registerMap.put(LetterType.DOVE_REQUEST.getRegisterName(),new ExecuteFlyDove());
        registerMap.put(LetterType.DOVE_RESPONSE.getRegisterName(),new ResultFlyDove());


    }

    public static Object get(String name) {
        return registerMap.get(name);
    }

}
